
#include "gui.h"
#include "scr_print.h"
#include "menu.h"
#include "floating.h"
#include "config.h"

static int n_showed_views = 0;

int guiIsShowing()
{
	if (n_showed_views > 0)
		return 1;
	return 0;
}

void guiRefreshShowInfo()
{
	int num = 0;
	if (isShowingMenu())
		num++;
	if (g_setting_config.show_cpu)
		num++;
	if (g_setting_config.show_memory)
		num++;
	if (g_setting_config.show_fps)
		num++;
	if (g_setting_config.show_battery)
		num++;

	if (num > 0 && n_showed_views <= 0)
		scrPrintInit();
	else if (num <= 0 && n_showed_views > 0)
		scrPrintFinish();
	n_showed_views = num;
}

void guiCloseAll()
{
	if (isShowingMenu())
		closeMenu();
}

void guiDrawAll()
{
	if (isShowingMenu())
		drawMenu();
	drawFloating();
}

void guiCtrlAll()
{
	if (isShowingMenu())
		ctrlMenu();
}
